import { createRouter, createWebHistory } from 'vue-router';

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: () => import('@/layout/Layout.vue'),
    redirect: '/dashboard',
    children: [
      {
        path: '/dashboard',
        name: 'Dashboard',
        component: () => import('@/views/Dashboard.vue'),
        meta: { title: '数据概览' }
      },
      {
        path: '/fish-species',
        name: 'FishSpecies',
        component: () => import('@/views/FishSpecies.vue'),
        meta: { title: '鱼类种类管理' }
      },
      {
        path: '/fish-distribution',
        name: 'FishDistribution',
        component: () => import('@/views/FishDistribution.vue'),
        meta: { title: '渔业分布管理' }
      },
      {
        path: '/fish-production',
        name: 'FishProduction',
        component: () => import('@/views/FishProduction.vue'),
        meta: { title: '渔业产量分析' }
      },
      {
        path: '/ecological-analysis',
        name: 'EcologicalAnalysis',
        component: () => import('@/views/EcologicalAnalysis.vue'),
        meta: { title: '生态环境分析' }
      },
      {
        path: '/picture-upload',
        name: 'PictureUpload',
        component: () => import('@/views/tools/PictureUpload.vue'),
        meta: { title: '图片上传' }
      },
      {
        path: '/fishery-screen',
        component: () => import('@/views/FisheryScreen.vue'),
        meta: {
          title: '渔业资源大屏'
        }
      }
    ]
  },
  {
    path: '/user',
    name: 'User',
    component: () => import('@/layout/UserLayout.vue'),
    redirect: '/user/login',
    children: [
      {
        path: 'login',
        name: 'UserLogin',
        component: () => import('@/views/user/UserLogin.vue'),
        meta: { title: '用户登录' }
      },
      {
        path: 'register',
        name: 'UserRegister',
        component: () => import('@/views/user/UserRegister.vue'),
        meta: { title: '用户注册' }
      },
      {
        path: 'setting',
        name: 'UserSetting',
        component: () => import('@/views/user/setting.vue'),
        meta: { title: '个人设置' }
      }
    ]
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router; 